MySQL Server Connection
The MySQL server runs as a service (daemon) in the background. We (the users or applications) connect to it using:
- Command Line Interface (CLI)
- MySQL Workbench (GUI)
- Programming Languages (Python, PHP, Java, Node.js, etc.)
Connecting via Command Line
The mysql client is a command-line program installed with MySQL.
mysql -h hostname -u username -p
-h→ host (where MySQL is running, default islocalhost).-u→ username (default isroot).-p→ prompts for password.
Local Connection:
mysql -u root -p
It will ask for the root password. Once entered, you get the mysql> prompt.
Now you can run queries
Remote Connection:
mysql -h mydb-instance.abcd1234.us-east-1.rds.amazonaws.com -u admin -p